package com.java.service.impl;

import com.java.service.TokenService;
import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.Set;

@Component
public class MemoryTokenServiceImpl implements TokenService {

    private Set<String> tokens = new HashSet<>();

    @Override
    public void save(String token) {
        tokens.add(token);
    }

    @Override
    public void remove(String token) {
        tokens.remove(token);
    }

    @Override
    public boolean exists(String token) {
        return tokens.contains(token);
    }
}
